package example.factory.abstr;


import example.factory.Car;

public abstract class AbstractFactory {

    protected abstract Car getCar();

    public Car getCar(String type) {
        if ("bmw".equalsIgnoreCase(type)) {
            return new BmwFactory().getCar();
        } else if ("audi".equalsIgnoreCase(type)) {
            return new AudiFactory().getCar();
        } else if ("benz".equalsIgnoreCase(type)) {
            return new BenzFactory().getCar();
        } else {
            return null;
        }
    }
}
